<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Jenssegers\Agent\Facades\Agent;
use Illuminate\Support\Facades\Config;


class LevelIntroductionController extends Controller
{
    // 中文版课程介绍
    public function showLevelIntroduction ($courseId) {

        $levelDetail = config('LevelIntroduction.course'.$courseId);

        if($levelDetail == null) return view('LevelIntroduction.emptyLevel')->with('tablet', true);

        if(Agent::isTablet() || strpos(Agent::getUserAgent(),'U26') || strpos(Agent::getUserAgent(),'U27') || strpos(Agent::getUserAgent(),'Umix'))
            return view('LevelIntroduction.tablet')->with('tablet', true);
        else if(Agent::isPhone())
            return view('LevelIntroduction.phone')->with('tablet', true);
        else
            return view('LevelIntroduction.pc')->with('tablet', true);
    }

    // 英文版课程介绍
    public function showLevelIntroductionEn ($courseId) {
        $levelDetail = config('LevelIntroduction.course'.$courseId);

        if($levelDetail == null) return view('LevelIntroductionEn.emptyLevel')->with('tablet', true);

        if(Agent::isTablet() || strpos(Agent::getUserAgent(),'U26') || strpos(Agent::getUserAgent(),'U27') || strpos(Agent::getUserAgent(),'Umix'))
            return view('LevelIntroductionEn.tablet')->with('tablet', true);
        else if(Agent::isPhone())
            return view('LevelIntroductionEn.phone')->with('tablet', true);
        else
            return view('LevelIntroductionEn.pc')->with('tablet', true);
    }
    
    public function showSiteLevelIntro($level) {
	
			$levelDetail = config('LevelIntroduction.course'.$level);
	
			if($levelDetail == null) return view('LevelIntroduction.emptyLevel')->with('tablet', true);
			return view('LevelIntroduction.site')->with('tablet', true);
		}
}


